import tkinter as tk
from tkinter import messagebox

class application(tk.Frame):
    def __init__(self,master=None):
        self.master=master
        super().__init__()
        self.creatAPP()

    def creatAPP(self):
        self.v1=tk.StringVar()
        self.v1.set("f")
        self.r1=tk.Radiobutton(self.master,text="男",value='m',variable=self.v1).pack(side='left')
        self.r2=tk.Radiobutton(self.master,text='女',value='f',variable=self.v1).pack(side='left')

        self.b1=tk.Button(self.master,text='submit',command=self.submit).pack(side='left')

    def submit(self):
        messagebox.showinfo('sex',f"性别{self.v1.get()}")

window=tk.Tk()
window.geometry('1000x200')
app=application(window)
window.mainloop()